Skip to content

Conversation

helenul
Copy link
Member

@helenul helenul commented Nov 9, 2026

Changes

Explore Plants

  • Show the number of results above the plants, with singular and plural text, in an aria-live region so screen readers hear it change.
  • Add numbered pagination, so users can jump to any page. The first and last page are always shown, with "…" in between, so it works for any number of pages.
  • Make the ✿ button a toggle: click again to remove the plant from My Matches. The accessible name and tooltip show whether it adds or removes.
  • Remove the Apollo cache warning when a match is removed (merge: false on User.matchedPlants).

Splitting up ExplorePlants.tsx

  • Pagination and getPageItems in components/pagination, with texts in their own pagination translation block.
  • FilterSelect in components/filterSelect, with the filters defined in one list.
  • SortMenu in components/sortMenu, with the keyboard navigation.
  • useExploreParams in hooks/ for the URL state. A new search, filter or sort order always goes back to page 1.

All three components take already translated texts, so they can be reused on other pages.

Backend

  • Add an index on commonName and _id for sorting by name, created when the server starts (indexes.ts). Z–A now reverses _id too, so both directions use the index.
  • Add tests/tsconfig.json, so the backend tests are type-checked without changing the build.

Tests

  • New: getPageItems, FilterSelect, SortMenu, useExploreParams and indexes tests.
  • ExplorePage.test.tsx: number of results, adding and removing matches with the ✿ button, English test data, and updated snapshots.
  • uiMatchAndRemovePlant: removing a plant again from Explore Plants. uiAccessibility checks the matched ✿ button.

Documentation

  • Updated README, architecture.md, quality.md, tests.md and AI usage, including why we use offset-based pagination and why only sorting by name has an index.

Move pagination to components/pagination, add page buttons to jump to a specific page, move texts to a "pagination" translation block, add getPageItems tests and update Explore tests and snapshots.
Add and remove plants from My Matches with the same button. Update component and e2e tests and snapshots, and use English consistently in the changed test files.
Move the three filter dropdowns into FilterSelect in components/filterSelect, defined from one FILTERS list. The markup is unchanged, so existing tests and snapshots still pass. Add FilterSelect tests.
Remove the cache warning when a match is removed by setting merge: false on User.matchedPlants, so the Apollo cache replaces the list with the whole list from the backend instead of trying to merge them.
Create index on commonName and _id at server start, reverse _id in Z–A sort to use the index, add index test, and add tests/tsconfig.json so tests are type-checked without changing the build.
Update architecture.md, quality.md, tests.md, README and AI usage for pagination, FilterSelect, the ✿ toggle, the name index and offset pagination. Add tests for the number of results.
…dd tests, update the documentation accordingly and run prettier
@helenul helenul requested a review from a team as a code owner November 9, 2026 14:55
@helenul helenul linked an issue Nov 9, 2026 that may be closed by this pull request
6 tasks
alexajah
alexajah previously approved these changes Nov 10, 2026
@helenul helenul requested a review from alexajah November 10, 2026 11:56
@helenul helenul merged commit 063d503 into main Nov 10, 2026
0 of 4 checks passed
@helenul helenul deleted the 119-improve-exploreplants-based-on-feedback branch November 10, 2026 12:24
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve ExplorePlants based on feedback
2 participants